{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Untitled0.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "A5bP_SXnIfqz"
      },
      "source": [
        "#@markdown <h3>⬅️ Click Here to Start</h3>\n",
        "#@markdown <center><h3>Aria2 for Colab<br />\n",
        "\n",
        "#rclone安装\n",
        "!curl  https://rclone.org/install.sh 2>/dev/null | sudo bash &> /dev/null\n",
        " \n",
        "#rclone配置\n",
        "Rclone_config = \"https://yourworld.com/rclone.conf\"  # @param {type:\"string\"}\n",
        "!wget echo $Rclone_config -P /root/.config/rclone/ &> /dev/null\n",
        "\n",
        "#Aria2一键完美配置脚本一键安装\n",
        "!apt install wget curl ca-certificates &> /dev/null\n",
        "!wget -N git.io/aria2.sh &> /dev/null && chmod +x aria2.sh &> /dev/null\n",
        "!echo 1|./aria2.sh &> /dev/null\n",
        "!echo 12|./aria2.sh &> /dev/null\n",
        "\n",
        "#搬运Github大佬配置\n",
        "import os\n",
        "import urllib.request\n",
        "from IPython.display import HTML, clear_output\n",
        " \n",
        "#####################################\n",
        "USE_FREE_TOKEN = False  # @param {type:\"boolean\"}\n",
        "REGION = \"US\"\n",
        "TOKEN = \"your ngrok token or use free token\"  # @param {type:\"string\"}\n",
        " \n",
        "HOME = os.path.expanduser(\"~\")\n",
        " \n",
        "if not os.path.exists(f\"{HOME}/.ipython/ocr.py\"):\n",
        "    hCode = \"https://raw.githubusercontent.com/hmglife/\" \\\n",
        "                \"aria2-colab/master/ocr.py\"\n",
        "    urllib.request.urlretrieve(hCode, f\"{HOME}/.ipython/ocr.py\")\n",
        " \n",
        " \n",
        "from ocr import loadingAn, PortForward_wrapper\n",
        " \n",
        "loadingAn()\n",
        " \n",
        "# START_SERVER\n",
        "# Ngrok region 'us','eu','ap','au','sa','jp','in'\n",
        "clear_output()\n",
        "PORT_FORWARD = \"ngrok\" \n",
        "Server = PortForward_wrapper(\n",
        "    PORT_FORWARD, TOKEN, USE_FREE_TOKEN, [['Aria2_rpc', 6800, 'http']], REGION.lower(), \n",
        "    [f\"{HOME}/.ngrok2/aria2.yml\", 5042]\n",
        ")\n",
        " \n",
        "data = Server.start('Aria2_rpc', displayB=False)\n",
        "Host = data['url'][7:]  \n",
        "port = \"80\"\n",
        "clear_output()\n",
        " \n",
        "rpc0 = !grep \"^rpc-secret=\" /root/.aria2c/aria2.conf | awk -F \"=\" '{print $NF}'\n",
        "rpc = (\"\").join(rpc0)\n",
        "rpc64 = !echo -n $rpc | base64\n",
        "rpc_secret = (\"\").join(rpc64)\n",
        " \n",
        "showUrL = \"http://ariang.js.org/#!/settings/rpc/set/ws/\" + Host + \"/80/jsonrpc/\" + rpc_secret\n",
        " \n",
        "showTxT = \"Success! Click Here to Start AriaNg\"\n",
        " \n",
        "display(HTML('''<style>@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro:200,900');  :root {   --text-color: '''+'hsla(10, 50%, 85%, 1)'+''';   --shadow-color: '''+'hsla(10, 40%, 52%, .4)'+''';   --btn-color: '''+'hsla(10, 86%, 56%, 1)'+''';   --bg-color: #141218; }  * {   box-sizing: border-box; } button { position:relative; padding: 10px 20px;     border: none;   background: none;   cursor: pointer;      font-family: \"Source Code Pro\";   font-weight: 900;   font-size: 100%;     color: var(--text-color);      background-color: var(--btn-color);   box-shadow: var(--shadow-color) 2px 2px 22px;   border-radius: 4px;    z-index: 0;     overflow: hidden;    }  button:focus {   outline-color: transparent;   box-shadow: var(--btn-color) 2px 2px 22px; }  .right::after, button::after {   content: var(--content);   display: block;   position: absolute;   white-space: nowrap;   padding: 40px 40px;   pointer-events:none; }  button::after{   font-weight: 200;   top: -30px;   left: -20px; }   .right, .left {   position: absolute;   width: 100%;   height: 100%;   top: 0; } .right {   left: 66%; } .left {   right: 66%; } .right::after {   top: -30px;   left: calc(-66% - 20px);      background-color: var(--bg-color);   color:transparent;   transition: transform .4s ease-out;   transform: translate(0, -90%) rotate(0deg) }  button:hover .right::after {   transform: translate(0, -47%) rotate(0deg) }  button .right:hover::after {   transform: translate(0, -50%) rotate(-7deg) }  button .left:hover ~ .right::after {   transform: translate(0, -50%) rotate(7deg) }  /* bubbles */ button::before {   content: '';   pointer-events: none;   opacity: .6;   background:     radial-gradient(circle at 20% 35%,  transparent 0,  transparent 2px, var(--text-color) 3px, var(--text-color) 4px, transparent 4px),     radial-gradient(circle at 75% 44%, transparent 0,  transparent 2px, var(--text-color) 3px, var(--text-color) 4px, transparent 4px),     radial-gradient(circle at 46% 52%, transparent 0, transparent 4px, var(--text-color) 5px, var(--text-color) 6px, transparent 6px);    width: 100%;   height: 300%;   top: 0;   left: 0;   position: absolute;   animation: bubbles 5s linear infinite both; }  @keyframes bubbles {   from {     transform: translate();   }   to {     transform: translate(0, -66.666%);   } }    Resources</style><center><a href=\"'''+showUrL+'''\" target=\"_blank\"><div style=\"width: 570px;   height: 80px; padding-top:15px\"><button style='--content: \"'''+showTxT+'''\";'\">   <div class=\"left\"></div>'''+showTxT+'''<div class=\"right\"></div> </div></button></a></center>'''))\n",
        " \n",
        "display(HTML(\"\"\"<style>@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro:200,900');  :root {   --text-color: hsla(210, 50%, 85%, 1);   --shadow-color: hsla(210, 40%, 52%, .4);   --btn-color: hsl(210, 80%, 42%);   --bg-color: #141218; }  * {   box-sizing: border-box; } button { position:relative; padding: 10px 20px;     border: none;   background: none;      font-family: \"Source Code Pro\";   font-weight: 900;font-size: 100%;     color: var(--text-color);      background-color: var(--btn-color);   box-shadow: var(--shadow-color) 2px 2px 22px;   border-radius: 4px;    z-index: 0;overflow: hidden; -webkit-user-select: text;-moz-user-select: text;-ms-user-select: text;user-select: text;}  button:focus {   outline-color: transparent;   box-shadow: var(--btn-color) 2px 2px 22px; }  .right::after, button::after {   content: var(--content);   display: block;   position: absolute;   white-space: nowrap;   padding: 40px 40px;   pointer-events:none; }  button::after{   font-weight: 200;   top: -30px;   left: -20px; }   .right, .left {   position: absolute;   width: 100%;   height: 100%;   top: 0; } .right {   left: 66%; } .left {   right: 66%; } .right::after {   top: -30px;   left: calc(-66% - 20px);      background-color: var(--bg-color);   color:transparent;   transition: transform .4s ease-out;   transform: translate(0, -90%) rotate(0deg) }  button:hover .right::after {   transform: translate(0, -47%) rotate(0deg) }  button .right:hover::after {   transform: translate(0, -50%) rotate(-7deg) }  button .left:hover ~ .right::after {   transform: translate(0, -50%) rotate(7deg) }  /* bubbles */ button::before {   content: '';   pointer-events: none;   opacity: .6;   background:     radial-gradient(circle at 20% 35%,  transparent 0,  transparent 2px, var(--text-color) 3px, var(--text-color) 4px, transparent 4px),     radial-gradient(circle at 75% 44%, transparent 0,  transparent 2px, var(--text-color) 3px, var(--text-color) 4px, transparent 4px),     radial-gradient(circle at 46% 52%, transparent 0, transparent 4px, var(--text-color) 5px, var(--text-color) 6px, transparent 6px);    width: 100%;   height: 300%;   top: 0;   left: 0;   position: absolute;   animation: bubbles 5s linear infinite both; }  @keyframes bubbles {   from {     transform: translate();   }   to {     transform: translate(0, -66.666%);   } }.zui-table {    border: solid 1px #DDEEEE;    border-collapse: collapse;    border-spacing: 0;    font: normal 13px;}.zui-table thead th {    background-color: #DDEFEF;    border: solid 1px #DDEEEE;    color: #0000009e;    padding: 10px;    text-align: left;}.zui-table tbody td {border: solid 1px #effff97a;color: #ffffffd1;    padding: 10px;}</style><center><button><table class=\"zui-table blueBG\"><p>Aria2 rpc config<p><thead>        <tr>            <th>Protocol</th>            <th>Host</th>            <th>Port</th>        </tr>    </thead>    <tbody>        <tr>            <td>WebSocket</td><td>\"\"\"+Host+\"\"\"</td><td>\"\"\"+port+\"\"\"</td></tr></tbody></table><a target=\"_blank\" style=\"text-decoration: none;color: hsla(210, 50%, 85%, 1);font-size: 10px;\" href=\"https://raw.githubusercontent.com/biplobsd/OneClickRun/master/img/aria2RpcConfigSetup.gif\">NB. How to setup this's config. [Click ME]</a></button><center>\"\"\"))"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "cellView": "form",
        "id": "xsznXiLUKDDQ"
      },
      "source": [
        "#@markdown <h3>⬅️ Click Here to Start</h3>\n",
        "#@markdown <center><h3>Rclone Upload<br />\n",
        "\n",
        "Source = \"/root/downloads\"  # @param {type:\"string\"}\n",
        "DriveID = \"td1\"  # @param {type:\"string\"}\n",
        "Location = \"/\\u4E34\\u65F6\\u6587\\u4EF6/\\u79BB\\u7EBF\\u4E0B\\u8F7D/Colab\"  # @param {type:\"string\"}\n",
        "!rclone copy $Source $DriveID:$Location\n",
        "print(\"Success!\")"
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}